LEX = flex
YACC = bison -d
CC = gcc
CFLAGS=-g
DOT = dot
DEBUG= --report=state
SRCS=sem.c synt.c $(wildcard structures/*.c) $(wildcard *.c)
OBJS=$(SRCS:.c=.o)

.PHONY: clean run graph

run : clean synt.c sem.c compilateur 

graph : dot.jpg

compilateur:  $(OBJS)
	$(CC) -o $@ $^ -g

synt.c: grammaire_simple.y
	$(YACC) -o $@ $< $(DEBUG)

sem.c: sem.l
	$(LEX) -o $@ $<

dot.jpg: dot.out
	$(DOT) $^ -Tjpg -o $@ 

clean:
	rm -f *.o compilateur *~ dot.jpg $(OBJS)
